package com.holly.unit.deform.designer.core.table;

import com.holly.unit.deform.designer.context.FormDesignerDbContext;
import com.holly.unit.deform.designer.service.CreateTableFieldService;
import com.holly.unit.deform.designer.service.CreateTableService;

/**
 * 类描述: 表单生成物理表数据定义语言抽象类
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/8/2 10:32
 */
public abstract class DbTableDDLBase {

    protected String CREATE_DDL = "create table ${table} (" +
            "id bigint(20) NOT NULL COMMENT '主键' PRIMARY KEY," +
            "${fields}," +
            "create_time datetime DEFAULT NULL COMMENT '创建时间', " +
            "create_user bigint(20) DEFAULT NULL COMMENT '创建人',"+
            "update_time datetime DEFAULT NULL COMMENT '更新时间',"+
            "update_user bigint(20) DEFAULT NULL COMMENT '更新人',"+
            "del_flag char(1) CHARACTER SET utf8 NOT NULL DEFAULT 'N' COMMENT '删除标记：Y-已删除，N-未删除',"+
            ")";
    protected String DATA_FORMAT_VARCHAR = "varchar";
    protected String DATA_FORMAT_INT = "int";
    protected String DATA_FORMAT_NUMERIC = "numeric";
    protected String DATA_FORMAT_DATETIME = "datetime";
    protected String DATA_FORMAT_TEXT = "text";
    protected String DATA_FORMAT_LONG_TEXT = "longtext";
    protected String FIELD_ID = "id";

    protected CreateTableService createTableService = FormDesignerDbContext.createTableService();
    protected CreateTableFieldService tableFieldService = FormDesignerDbContext.createTableFieldService();
}
